<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Extending Ajax Tests</title>
<link type="text/css" rel="stylesheet" href="http://code.jquery.com/qunit/qunit-git.css">
<script type="text/javascript" src="http://code.jquery.com/qunit/qunit-git.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="jquery.extendingajax.js"></script>
<script type="text/javascript">
$.ajax.simulateHtml['default'] = {delay: 500, variation: 1000, html: ''};
$.ajax.simulateHtml['test.html'] = {delay: 500, variation: 1000, html: '<p>Try this instead<\/p>'};

asyncTest('Ajax simulation', function() {
	expect(1);
	$.ajax('test.html', {dataType: 'html', success: function(data) {
		equal($(data).text(), 'Try this instead', 'Ajax substitution');
		start();
	}});
});

asyncTest('Ajax not found', function() {
	expect(1);
	$.ajax('other.html', {dataType: 'html', success: function(data) {
		ok(false, 'Page found');
		start();
	}, error: function(jqXHR, textStatus, errorThrown) {
		ok(jqXHR.status == 404 && textStatus == 'error',
			'Page missing');
		start();
	}});
});
</script>
</head>

<body>
<div id="qunit"></div>
<div id="qunit-fixture">
</div>
</body>
</html>
